#include "main.h"
#include "pid.h"
#include "rc_cmd.h"
#include "usart.h"

int a2 = 1;

void RC_CMD()
{
		if(RC_CODE == 'A')
		{
			final_pid_set(20,20);
		}
		//turn right
		if(RC_CODE == 'B')
		{
			final_pid_set(20,0);
		}
		//turn left
		if(RC_CODE == 'C')
		{
			final_pid_set(0,20);
		}
		//stop
		if(RC_CODE == 'D')
		{
			final_pid_set(0,0);
		}
		if(RC_CODE == 'E')
		{
			Transmit_1();
		}
		if(RC_CODE == 'J'&&a2==1)
		{
			Transmit_2();
		}
		if(RC_CODE == 'F')
		{
			HAL_UART_Transmit(&huart4,(uint8_t *)"A",1,0xfffff);
			HAL_Delay(1000);
		}
		if(RC_CODE == 'G')
		{
			HAL_UART_Transmit(&huart4,(uint8_t *)"B",1,0xfffff);
			HAL_Delay(1000);
		}
		if(RC_CODE == 'H')
		{
			HAL_UART_Transmit(&huart4,(uint8_t *)"C",1,0xfffff);
			HAL_Delay(1000);
		}
		if(RC_CODE == 'I')
		{
			HAL_UART_Transmit(&huart4,(uint8_t *)"D",1,0xfffff);
			HAL_Delay(1000);
		}
}
